<?php
/*
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 * $Id: 2017-12-13 03:39:35 apple $
*/
defined('BY_JYA') or exit('error');
global $_RQ,$_AR;
$_RQ['op']=$_RQ['op']?$_RQ['op']:'list';
$return=array();
if($_RQ['op']=='list'){
	$pindex = max(1, intval($_RQ['page']));
	$psize = 10;
	$params=array('uniacid'=>$_SESSION['uniacid'],'type'=>array(4,5));
	$return['params']=array();
	//会员ID
	if(!empty($_RQ['type'])){
		$params['type']=intval($_RQ['type']);
		$return['params']['type']=$_RQ['type'];
	}
	$list=pdo_getslice('jy_ylfee_feelog',$params,array($pindex,$psize),$total,array(),'','id desc');
	foreach($list as &$item){
	}
	$return['list']=$list?$list:array();
	$totalpage=ceil($total/$psize);
	$totalpage=intval($totalpage);
	$return['totalpage'] =$totalpage;
	$return['params']['page'] =$pindex;
	$return['htmls']=array(
		'type'=>'list',
		'tabs'=>array(
			array('op'=>'list','title'=>'效益/扶商工资发放记录'),
			array('op'=>'upfee','title'=>'发放上个月工资'),
		),
		'list'=>array('data'=>'list','edit'=>false,'list'=>array(
			array('name'=>'month','title'=>'发放月份','type'=>'string'),
			array('type'=>'radio','title'=>'类型','name'=>'type','options'=>'types'),
			array('name'=>'getfee','title'=>'总收益计算流水额','type'=>'string'),
			array('name'=>'payfee','title'=>'总发放工资金额','type'=>'string'),
			array('name'=>'num','title'=>'总发放工资人数','type'=>'string'),
			array('name'=>'createtime','title'=>'创建时间','type'=>'time'),
		)),
		'search'=>array(
			array('type'=>'radio','width'=>15,'title'=>'类型','name'=>'type','options'=>'types'),
		),
	);
	$return['types']=array(
		5=>'工资',
	);
	exi($return);
}
if($_RQ['op'] == 'upfee'){
	$this->model('commission')->upfee5();
	exi('操作成功！','','list');
}
if($_RQ['op'] == 'del'){
	$id=intval($_RQ['id']);
	if($id){
		pdo_delete('jy_ylfee_feelog',array('id'=>$id,'uniacid'=>$_SESSION['uniacid']));
	}
	$del=trim($_RQ['del'],';');
	if($del){
		$del=explode(';',$del);
		foreach($del as $id){
			$id=intval($id);
			if($id){
				pdo_delete('jy_ylfee_feelog',array('id'=>$id,'uniacid'=>$_SESSION['uniacid']));
			}
		}
	}
	exi('删除成功！');
}